import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import Element from 'element-ui'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import './styles/element-variables.scss'
import '@/styles/index.scss' // global css1111
import '@/styles/system-public.less' // global css1111

import store from './store'
import './plugins/elementConfig'
import './plugins/echartsConfig'
import {i18n} from './plugins/i18n.js'


import {parseTime} from '@/views/excel/utils'

Vue.use(Element)
Vue.filter("parseTime",parseTime)
Vue.config.productionTip = false

//刷新保存状态
if (sessionStorage.getItem("store")) {
  store.replaceState(
      Object.assign(
          {},
          store.state,
          JSON.parse(sessionStorage.getItem("store"))
      )
  );
  sessionStorage.removeItem("store")
}

//监听，在页面刷新时将vuex里的信息保存到sessionStorage里
window.addEventListener("beforeunload", () => {
  sessionStorage.setItem("store", JSON.stringify(store.state));
});


new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
